package com.common.util.repay_plan;
import com.common.util.date.DateUtil;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @describe: 还款计划需要业务提供的计算条件
 */
public class RepayPlanCondition {

    public enum Type {
        /**
         * 等额本金
         */
        WAY1,
        /**
         * 按月付息到期还本
         */
        WAY2,
        /**
         * 按季节付息到期还本
         */
        WAY3,
        /**
         * 到期还本付息
         */
        WAY4,
        /**
         * 等本等息
         */
        WAY5;
    }
    /**还款计划方式*/
    private Type type;
    /**计息开始时间*/
    private Date startTime;
     /**借款天数*/
    private int loanDays;
    /**固定还款日*/
    private int fixedRepayDay;
    /**借款总金额*/
    private BigDecimal amt;
    /**借款年利率*/
    private BigDecimal rate;
    /**年化天数*/
    private int annualNumberOfDays;

    public static RepayPlanCondition createCondition(){
        return new RepayPlanCondition();
    }

    public Type getType() {
        return type;
    }

    public Date getStartTime() {
        return startTime;
    }

    public int getLoanDays() {
        return loanDays;
    }

    public int getFixedRepayDay() {
        return fixedRepayDay;
    }

    public BigDecimal getAmt() {
        return amt;
    }

    public BigDecimal getRate() {
        return rate;
    }

    public int getAnnualNumberOfDays() {
        return annualNumberOfDays;
    }

    public RepayPlanCondition setType(Type type) {
        this.type = type;
        return this;
    }

    public RepayPlanCondition setStartTime(Date startTime) {
        this.startTime = DateUtil.getBeginTime(startTime);
        return this;
    }

    public RepayPlanCondition setLoanDays(int loanDays) {
        this.loanDays = loanDays;
        return this;
    }

    public RepayPlanCondition setFixedRepayDay(int fixedRepayDay) {
        this.fixedRepayDay = fixedRepayDay;
        return this;
    }

    public RepayPlanCondition setAmt(BigDecimal amt) {
        this.amt = amt;
        return this;
    }

    public RepayPlanCondition setRate(BigDecimal rate) {
        this.rate = rate;
        return this;
    }

    public RepayPlanCondition setAnnualNumberOfDays(int annualNumberOfDays) {
        this.annualNumberOfDays = annualNumberOfDays;
        return this;
    }
}
